package com.zecan.blog.vo.article;

import com.zecan.blog.entity.Article;
import lombok.Data;

/**
 * 首页显示文章的信息
 *
 * @ClassName ArticleMsgVo
 * @Description
 * @date 2022/11/6 14:25
 * @Version 1.0
 */
@Data
public class ArticleMsgVo {

    Integer articleId;
    Long articleAuthorId;
    String articleContent;
    String articleTitle;
    String articleDescription;
    String articleImgUrl;
    String articleAuthorName;
    String articleAuthorAvatar;
    String articleCreateTime;
    String articleClassify;
    Integer articleLikeCount;
    Integer articleView;
    boolean articleIsGood;
    boolean articleIsStar;

    boolean articleFollow;

    public static ArticleMsgVo buildArticleMsgVo(
            Article article,boolean isGood, boolean isStar,boolean isFollow) {
        ArticleMsgVo articleMsgVo = new ArticleMsgVo();
        articleMsgVo.articleId = article.getArticleId();
        articleMsgVo.articleAuthorId = article.getArticleAuthorId();
        articleMsgVo.articleAuthorAvatar = article.getArticleAuthorAvatar();
        articleMsgVo.articleTitle = article.getArticleTitle();
        articleMsgVo.articleAuthorName = article.getArticleAuthorName();
        articleMsgVo.articleCreateTime = article.getArticleCreateTime();
        articleMsgVo.articleClassify = article.getArticleClassify();
        articleMsgVo.articleImgUrl = article.getArticleImage();
        articleMsgVo.articleLikeCount = article.getArticleLikeCount();
        articleMsgVo.articleDescription = article.getArticleDescription();
        articleMsgVo.articleView = article.getArticleViews();
        articleMsgVo.articleContent = article.getArticleContent();
        articleMsgVo.articleIsGood = isGood;
        articleMsgVo.articleIsStar = isStar;
        articleMsgVo.articleFollow = isFollow;
        return articleMsgVo;
    }




}
